package com.ruoyi.kenuo.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.kenuo.domain.LunBo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kenuo.service.IKernelLunBoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.core.domain.AjaxResult;
/**
 * @author POLO_TANG
 * @version 1.0.0
 * @ClassName KernelLunBo
 * @description: TODO
 * @date 2023年09月07日
 */
@RestController
@RequestMapping("/kenuo/lunbo")
public class KernelLunBoController extends BaseController {

    @Autowired
    private IKernelLunBoService LunBoService;

    /**
     * 查询【请填写功能名称】列表
     */
    //@PreAuthorize("@ss.hasPermi('kenuo:lunbo:list')")
    @GetMapping("/list")
    public TableDataInfo list(LunBo LunBo)
    {
        startPage();
        List<LunBo> list = LunBoService.selectLunBoList(LunBo);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('kenuo:lunbo:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, LunBo LunBo)
    {
        List<LunBo> list = LunBoService.selectLunBoList(LunBo);
        ExcelUtil<LunBo> util = new ExcelUtil<LunBo>(LunBo.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('kenuo:lunbo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(LunBoService.selectLunBoById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('kenuo:lunbo:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LunBo LunBo)
    {
        return toAjax(LunBoService.insertLunBo(LunBo));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('kenuo:lunbo:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LunBo LunBo)
    {
        return toAjax(LunBoService.updateLunBo(LunBo));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('kenuo:lunbo:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(LunBoService.deleteLunBoByIds(ids));
    }

}
